<HTML><HEAD><TITLE>lp_solve(+Handle, -Cost)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">library(eplex)</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>lp_solve(+Handle, -Cost)</H1>
Explicitly invoke the external solver.
<DL>
<DT><EM>Handle</EM></DT>
<DD>Handle to a solver state
</DD>
<DT><EM>Cost</EM></DT>
<DD>Value of returned solution
</DD>
</DL>
<H2>Description</H2>
<P>
   A solver that was setup manually with lp_solve/2 needs to be 
   triggered explicitly using this predicate. 
</P><P>
   The external solver's LP, QP or MIP solver is applied to the
   problem represented by Handle.  Precisely which method is used
   depends on the options given to lp_setup/4.  lp_solve/2 fails if
   there is no solution or succeeds if an optimal solution is found,
   returning the solution's cost in Cost (unlike with lp_demon_setup/5,
   Cost gets instantiated to a number).  After a success, various
   solution and status information can be retrieved using lp_get/3
   and lp_var_get/4.
</P><P>
   Normally, the external solver is invoked once per call in this
   predicate, but if the problem contain cutpool constraints (see
   lp_add_cutpool_constraints/4), then the external solver may be invoked
   repeatedly to produce a solution which does not violate the cutpool
   constraints. 
</P><P>
   When a solver is triggered repeatedly, each invocation will
   automatically take into account the current variable bounds.  The set of
   constraints considered by the solver is the one given when the solver
   was created plus any new constraints that were added (lp_add/3) in the
   meantime.
</P><P>
   The user can define their own handlers (per eplex instance/problem) to
   handle cases where there was some  error condition, or some limits were 
   exceeded during the solving of the problem. If no handler was defined,
   by default an event would be raised. These are:
<DL>
    <DT>suboptimal handler (eplex_suboptimal event)<DD>
    	This means that a solution was found but it may be suboptimal.
	The default behaviour is to print a warning and succeed.
    <DT>unbounded_handler (eplex_unbounded event)<DD>
	This means that the problem is unbounded.  The default
	behaviour is to bind Cost to infinity (positive or negative
	depending on the optimisation direction), print a warning and
	succeed.  CAUTION: No solution values are computed when the
	problem is unbounded, so unless the problem was set up with
	the solution(no) option, an error will occur when trying to
	continue as if the optimisation had succeeded.
    <DT>infeasible_handler (eplex_infeasible event)<DD>
    	This means that the problem is infeasible. The default
	behaviour is to fail. Redefining this handler allows the 
        examination of the failed problem, e.g. obtaining an IIS for it.
    <DT>unknown_handler (eplex_unknown event)<DD>
    	This means that due to the solution method chosen, it is unknown
	whether the problem is unbounded or infeasible. The default
	behaviour is to print a warning and fail (even though this
	may be logically wrong!).
    <DT>abort_handler (eplex_abort event)<DD>
    	Some other error condition occurred during optimisation.
	The default behaviour is to print an error and abort.
</DL>
</P>
<H3>Fail Conditions</H3>
External solver was unable to find a solution.
<H3>Exceptions</H3>
<DL>
<DT><EM>(eplex_suboptimal) </EM>
<DD>Solution was found, but is possibly suboptimal
<DT><EM>(eplex_unbounded) </EM>
<DD>Problem is unbounded, no solution values
<DT><EM>(eplex_unknown) </EM>
<DD>Result is unknown (infeasible or unbounded)
<DT><EM>(eplex_abort) </EM>
<DD>External solver aborted for some reason
<DT><EM>(40) stale object handle </EM>
<DD>Handle not valid: solver state had been destroyed by cleanup
</DL>
<H2>See Also</H2>
<A HREF="../../lib/eplex/lp_setup-4.html">lp_setup / 4</A>, <A HREF="../../lib/eplex/lp_add-3.html">lp_add / 3</A>, <A HREF="../../lib/eplex/lp_get-3.html">lp_get / 3</A>, <A HREF="../../lib/eplex/lp_var_get-4.html">lp_var_get / 4</A>, <A HREF="../../lib/eplex/lp_add_cutpool_constraints-4.html">lp_add_cutpool_constraints / 4</A>
</BODY></HTML>
